package modelo;
import java.util.Vector;

import dao.DAOSubsidios;

public class SistemaContable extends Observer {
	
	private Vector<Double> descuentos;
	private static SistemaContable sistCont;
	
	private SistemaContable() {
		super();
		this.descuentos = new Vector<Double>();
		
	}

	public static SistemaContable getInstanciaObserver(){
		if (sistCont==null){
			sistCont=new SistemaContable();
		}
		return sistCont;
	}
	
	public void cargarDescuentosPorSubsidios(double montoTotal) {
		descuentos.add(montoTotal);		
	}
	
	public void notificar(){
		double total=0;
		for (int i=0;i<descuentos.size();i++){
			total=total+descuentos.elementAt(i);
		}
		DAOSubsidios.getInstancia().notificar(total);
		this.descuentos.clear();
	}
}
